package alesa.android.app.movil.util;

import alesa.android.app.movil.ui.R;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.GridView;
import android.widget.ImageView;

public class ImageAdapter extends BaseAdapter
{
	private Context Principal;
	// references to our images
    private Integer[] Imagenes = {
            R.drawable.ic_agproa, R.drawable.ic_indicadores,
            R.drawable.ic_modulo2};
	
	public ImageAdapter(Context host)
	{
		Principal = host;
	}
	
	public int getCount()
	{
		return Imagenes.length;
	}

	public Object getItem(int arg0)
	{
		return null;
	}

	public long getItemId(int position)
	{
		return 0;
	}

	public View getView(int position, View convertView, ViewGroup parent)
	{
		ImageView myImagen;
		
		if(convertView == null)
		{
			myImagen = new ImageView(Principal);
			myImagen.setLayoutParams(new GridView.LayoutParams(150,150));
			myImagen.setScaleType(ImageView.ScaleType.CENTER_CROP);
			myImagen.setPadding(8, 8, 8, 8);			
		}
		else
		{
			myImagen = (ImageView) convertView;
		}
		
		myImagen.setImageResource(Imagenes[position]);
		
		return myImagen;
	}
}
